#include <utils/Print.h>

#ifdef SOLAR_USE_QT
    #include <QDebug>
    #include <QString>
#else
    #if HAVE_STD_PRINT
        #include <print>
    #else
        #include <fmt/format.h>
    #endif
#endif

void solar::print(const std::string_view& str)
{
#ifdef SOLAR_USE_QT
    qDebug() << QString::fromStdString(static_cast<std::string>(str));
#else
    #if HAVE_STD_PRINT
    std::print(stdout, "{}", str);
    #else
    fmt::print(stdout, "{}", str);
    #endif
#endif
}

void solar::println(const std::string_view& str)
{
#ifdef SOLAR_USE_QT
    qDebug() << QString::fromStdString(static_cast<std::string>(str)) << '\n';
#else
    #if HAVE_STD_PRINT
    std::println(stdout, "{}", str);
    #else
    fmt::print(stdout, "{}\n", str);
    #endif
#endif
}
